<template>
  <div>
    <el-table
      :data="OrderList"
      :stripe="true"
      style="width: 100%">
      <el-table-column
        prop="id"
        label="编号">
      </el-table-column>
      <el-table-column
        label="下单人">
        <template slot-scope="scope">
          {{scope.row.user.name}}
        </template>
      </el-table-column>
      <el-table-column
        prop="ordertime"
        label="下单时间">
      </el-table-column>
      <el-table-column
        label="订单状态">
        <template slot-scope="scope">
          {{scope.row.orderstate==0?"未支付":"已支付"}}
        </template>
      </el-table-column>

      <el-table-column
        label="操作">
        <template slot-scope="scope">
          <a v-if="scope.row.orderstate==0" :href="'http://localhost:8989/order/pay?out_trade_no='+scope.row.id+'&subject='+scope.row.id+'&total_amount='+scope.row.goodprice"
             target="_blank">支付</a>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
    export default {
        name: "OrderList",
      data(){
          return {
            OrderList:[]
          }
      },
      created(){
        //发出ajax请求请求后端代码
        this.selectAll();
      },
      methods:{
        selectAll(){
          this.axios.get("/order/selectMyOrder").then((resp)=>{
            this.OrderList=resp.data;
          });
        }
      }
    }
</script>

<style scoped>

</style>
